<project name="StockholmsStad.WindowsServiceTest.Setup" default="Info">
  <include buildfile="Properties.Include" />

  <target name="Run">
    <call target="Info" />
    <call target="CopyResourceFiles" />
    <call target="Build" />
    <call target="CopyToDeployFolder" />
    <call target="CopyInstallToDeployFolder" />
  </target>

  <target name="Info">
    <echo message="${ProjectName} buildfile..." />
  </target>

  <target name="Build">
    <msbuild project="${ProjectFolder}.sln">
	<arg value="/t:rebuild" />
	<arg value="/p:Configuration=${Configuration}" />
	<arg value="/v:m" />
    </msbuild>

    <echo message="${DEVENVEXE} ${ProjectFolder}.sln /rebuild ${Configuration} /project ${SetupProjectFolder}\${SetupProjectName}.vdproj " />
    <exec program="${DEVENVEXE}" commandline="${ProjectFolder}.sln /rebuild ${Configuration} /project ${SetupProjectFolder}\${SetupProjectName}.vdproj " />
  </target>

  <target name="CopyResourceFiles">
    <copy todir="${ProjectFolder}\${ProjectName}\Resources\" overwrite="true">
      <fileset basedir="${Global.ConfigFolder}\${ProjectName}" >
        <include name="**/Resources.*" />
      </fileset>
    </copy>
  </target>

  <target name="CopyToDeployFolder">
    <nant buildfile="${Global.CoreTargetsBuildFile}" target="Core.CopySetupToDeployFolder" inheritall="true">
      <properties>
        <property name="Project.DeployFolder" value="${Global.WinServiceFolder}" />
        <property name="Project.ProjectFolder" value="${SetupProjectFolder}" />
      </properties>
    </nant>
  </target>

  <target name="CopyInstallToDeployFolder">
    <copy todir="${Global.WinServiceFolder}\">
      <fileset basedir="${Global.ScriptFolder}\WinServiceApp\" >
        <include name="*.cmd" />
      </fileset>
    </copy>
  </target>

</project>